Get rid of explicit usec refs in destinator, waypt, and unicsv.
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sat, 20 Jul 2013 02:41:38 +0000 (02:41 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sat, 20 Jul 2013 02:41:38 +0000 (02:41 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4462 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/destinator.cc
gpsbabel/unicsv.cc
gpsbabel/waypt.cc

index d35ac0c1a8e09479a41bd5c08753c160dbb28e8b..67c0c0e9e4a92dae763ff155285a67edf2bdd737 100644 (file)
@@ -334,8 +334,6 @@ destinator_read_trk(void)
     strptime(buff, "%d%m%y%H%M%S", &tm);
     int millisecs = (int) time % 1000;
     wpt->SetCreationTime(mkgmtime(&tm), millisecs);
-// FIXME: this is papering over a problem somewhere...
-wpt->microseconds = millisecs * 1000;
 
     if (wpt->fix > 0) {
       wpt->fix = (fix_type)(wpt->fix + 1);
index f1d8c0e14fc349a37df50887f3e84f2d2cd31e2f..fbc71311f7a7248d2d5b2f094a5081e5a0e94b4f 100644 (file)
@@ -1761,15 +1761,15 @@ unicsv_waypt_disp_cb(const waypoint *wpt)
       }
       snprintf(buf, sizeof(buf), "%02d:%02d:%02d", tm.tm_hour, tm.tm_min, tm.tm_sec);
 
-      if (wpt->microseconds > 0) {
-        int len = 6;
-        int ms = wpt->microseconds;
+      int millisecs = wpt->GetCreationTime().msec();
+      if (millisecs > 0) {
+        int len = 3;
 
-        while (len && (ms % 10 == 0)) {
-          ms /= 10;
+        while (len && (millisecs % 10 == 0)) {
+          millisecs /= 10;
           len--;
         }
-        snprintf(msec, sizeof(msec), ".%0*d", len, ms);
+        snprintf(msec, sizeof(msec), ".%0*d", len, millisecs);
         strcat(buf, msec);
       }
       gbfprintf(fout, "%s%s", unicsv_fieldsep, buf);
index dbb7ea686065d37291b60911a8697fb494081151..eb35939c9900eed7ee8101c29f6df92d1dfcfea1 100644 (file)
@@ -538,7 +538,8 @@ waypt_time(const waypoint *wpt)
   if (wpt->creation_time <= 0) {
     return (double) 0;
   } else {
-    return ((double)wpt->creation_time + ((double)wpt->microseconds / 1000000));
+
+    return ((double)wpt->creation_time + ((double)wpt->creation_time.msec() / 1000));
   }
 }